Immutable Objects for a Java-Like Language

نویسندگان

  • Christian Haack
  • Erik Poll
  • Jan Schäfer
  • Aleksy Schubert
چکیده

We extend a Java-like language with immutability specifications and a static type system for verifying immutability. A class modifier immutable specifies that all class instances are immutable objects. Ownership types specify the depth of object states and enforce encapsulation of representation objects. The type system guarantees that the state of immutable objects does not visibly mutate during a program run. Provided immutability-annotated classes and methods are final, this is true even if immutable classes are composed with untrusted classes that follow Java’s type system, but not our immutability type system.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Immutable Objects in Java

Immutability is a very useful and desirable property for objects. This paper investigates different possible notions of immutability for Java objects, to find out which notion is the most intuitive and useful, both when it comes to ways of enforcing immutability of objects, and when it comes to exploiting information about (im)mutability of objects in program verification and in various static ...

متن کامل

Objects Dynamically Changing Class (work in Progress)

This paper represents work in progress; we shall be regularly updating it with proofs, examples and comparisons. Abstract. We suggest language features that allow objects to mutate, i.e. change their class membership at run-time. These features could extend an imperative, typed, class-based, object-oriented language like Java. We give an operational semantics for a mutation operation that chang...

متن کامل

Changing Hashcodes: Objects, Intialisation, and Collections

Java requires objects’ hashcodes to be consistent with object equality, and to change only when an object’s equality changes. Equality dependent Java collections impose a stricter contextual contract on an objects’ equality, comparability, and hashcode methods: that they cannot change while those objects are in collections. By dynamically profiling 30 Java applications, we have determined that ...

متن کامل

Mining for Safety using Interactive Trace Analysis

This paper presents the results of a trace-based study of object and reference properties on a subset of the DaCapo benchmark suite with the intent to uncover facts about programs that can be leveraged by type systems, compilers and run-times. In particular, we focus on aliasing, and immutability, based on their recent application in the literature. To facilitate analyses like this one, we prev...

متن کامل

Behavioral Subtyping is Equivalent to Modular Reasoning for Object-oriented Programs

Behavioral subtyping is an established idea that enables modular reasoning about behavioral properties of object-oriented programs. It requires that syntactic subtypes are behavioral refinements. It validates reasoning about a dynamically-dispatched method call, say E .m(), using the specification associated with the static type of the receiver expression E . For languages with references and m...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2007